home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / gfx / show / gs_src_gs.lha / gs5.03 / gxcmap.h < prev    next >
C/C++ Source or Header  |  1997-05-06  |  4KB  |  96 lines

  1. /* Copyright (C) 1989, 1995, 1996, 1997 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of Aladdin Ghostscript.
  4.   
  5.   Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  6.   or distributor accepts any responsibility for the consequences of using it,
  7.   or for whether it serves any particular purpose or works at all, unless he
  8.   or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  9.   License (the "License") for full details.
  10.   
  11.   Every copy of Aladdin Ghostscript must include a copy of the License,
  12.   normally in a plain ASCII text file named PUBLIC.  The License grants you
  13.   the right to copy, modify and redistribute Aladdin Ghostscript, but only
  14.   under certain conditions described in the License.  Among other things, the
  15.   License requires that the copyright notice and this notice be preserved on
  16.   all copies.
  17. */
  18.  
  19. /* gxcmap.h */
  20. /* Private definition of color mapping for Ghostscript */
  21. /* Requires gxdcolor.h, gxdevice.h. */
  22. #include "gscsel.h"
  23. #include "gxfmap.h"
  24.  
  25. /* Procedures for rendering colors specified by fractions. */
  26.  
  27. #define cmap_proc_gray(proc)\
  28.   void proc(P5(frac, gx_device_color *, const gs_imager_state *,\
  29.            gx_device *, gs_color_select_t))
  30. #define cmap_proc_rgb(proc)\
  31.   void proc(P7(frac, frac, frac, gx_device_color *, const gs_imager_state *,\
  32.            gx_device *, gs_color_select_t))
  33. #define cmap_proc_cmyk(proc)\
  34.   void proc(P8(frac, frac, frac, frac, gx_device_color *,\
  35.            const gs_imager_state *, gx_device *, gs_color_select_t))
  36. #ifdef DPNEXT
  37. #define cmap_proc_rgb_alpha(proc)\
  38.   void proc(P8(frac, frac, frac, frac, gx_device_color *,\
  39.            const gs_imager_state *, gx_device *, gs_color_select_t))
  40. #endif
  41.  
  42. /* Because of a bug in the Watcom C compiler, */
  43. /* we have to split the struct from the typedef. */
  44. struct gx_color_map_procs_s {
  45.     cmap_proc_gray((*map_gray));
  46.     cmap_proc_rgb((*map_rgb));
  47.     cmap_proc_cmyk((*map_cmyk));
  48. #ifdef DPNEXT
  49.     cmap_proc_rgb_alpha((*map_rgb_alpha));
  50. #endif
  51. };
  52. typedef struct gx_color_map_procs_s gx_color_map_procs;
  53.  
  54. /* Determine the color mapping procedures for a device. */
  55. const gx_color_map_procs *gx_device_cmap_procs(P1(const gx_device *));
  56.  
  57. /* Set the color mapping procedures in the graphics state. */
  58. /* This is only needed when switching devices. */
  59. void gx_set_cmap_procs(P2(gs_imager_state *, const gx_device *));
  60.  
  61. /* Remap a concrete (frac) RGB or CMYK color. */
  62. /* These cannot fail, and do not return a value. */
  63. #define gx_remap_concrete_rgb(cr, cg, cb, pdc, pgs, dev, select)\
  64.   (*pgs->cmap_procs->map_rgb)(cr, cg, cb, pdc, pgs, dev, select)
  65. #define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pgs, dev, select)\
  66.   (*pgs->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pgs, dev, select)
  67. #ifdef DPNEXT
  68. #define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pgs, dev, select)\
  69.   (*pgs->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pgs, dev, select)
  70. #endif
  71.  
  72. /* Map a color, with optional tracing if we are debugging. */
  73. #ifdef DEBUG
  74. /* Use procedures in gxcmap.c */
  75. #include "gxcvalue.h"
  76. gx_color_index gx_proc_map_rgb_color(P4(gx_device *,
  77.   gx_color_value, gx_color_value, gx_color_value));
  78. gx_color_index gx_proc_map_rgb_alpha_color(P5(gx_device *,
  79.   gx_color_value, gx_color_value, gx_color_value, gx_color_value));
  80. gx_color_index gx_proc_map_cmyk_color(P5(gx_device *,
  81.   gx_color_value, gx_color_value, gx_color_value, gx_color_value));
  82. #  define gx_map_rgb_color(dev, vr, vg, vb)\
  83.      gx_proc_map_rgb_color(dev, vr, vg, vb)
  84. #  define gx_map_rgb_alpha_color(dev, vr, vg, vb, va)\
  85.      gx_proc_map_rgb_alpha_color(dev, vr, vg, vb, va)
  86. #  define gx_map_cmyk_color(dev, vc, vm, vy, vk)\
  87.      gx_proc_map_cmyk_color(dev, vc, vm, vy, vk)
  88. #else
  89. #  define gx_map_rgb_color(dev, vr, vg, vb)\
  90.      (*dev_proc(dev, map_rgb_color))(dev, vr, vg, vb)
  91. #  define gx_map_rgb_alpha_color(dev, vr, vg, vb, va)\
  92.      (*dev_proc(dev, map_rgb_alpha_color))(dev, vr, vg, vb, va)
  93. #  define gx_map_cmyk_color(dev, vc, vm, vy, vk)\
  94.      (*dev_proc(dev, map_cmyk_color))(dev, vc, vm, vy, vk)
  95. #endif
  96.